package com.bdqn.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.bdqn.dao.UsersDao;
import com.bdqn.entity.Users;

@Repository("usersDao")
public class UsersDaoImpl implements UsersDao {

	@Autowired
	private SqlSessionTemplate sqlSession;

	public Users login(String username, String pwd) {
		return sqlSession.getMapper(UsersDao.class).login(username, pwd);
	}

	public List<Users> getList(String username, int first, int maxReult) {
		return sqlSession.getMapper(UsersDao.class).getList(username, first,
				maxReult);
	}

	public int getCount(String username) {
		return sqlSession.getMapper(UsersDao.class).getCount(username);
	}

	public void add(Users users) {
		sqlSession.getMapper(UsersDao.class).add(users);
	}

	public Users getById(String username) {
		return sqlSession.getMapper(UsersDao.class).getById(username);
	}

	public void update(Users users) {
		sqlSession.getMapper(UsersDao.class).update(users);
	}

	public void del(String username) {
		sqlSession.getMapper(UsersDao.class).del(username);
	}

}
